<?php
	session_start();
	if (empty($_SESSION['usuario'])){
		session_destroy();
		header("Location:principal.php");
	}
	else{
		$tipo=$_GET["id_tipo"];
		$usuario=$_GET["id_usuario"];
	}
?>
<html>
	<head>
		<title>LA CIUDAD DE LOS LIBROS</title>
		<link href="../css/estilo.css" rel="stylesheet" type="text/css" />
	</head>
	<body >
		<div class="titulo">Registro de libros</div>
		<div class="menu">
			<?php
				include ("menu.php");
				if (empty($_SESSION['usuario'])){
					nomenu();
				}
				else{
					menu($tipo,$usuario);
				}
			?>
		</div>
		<div class="contenido">
			<div class="cerrarsesion">
				<?php echo $usuario;?> | <a href="principal.php">Cerrar Sesi&oacute;n</a>		
			</div>
			<marquee><h1 align=\"center\">LIBRER&Iacute;A VIRTUAL </h1></marquee><br/><br/>
			<div class="formulario">
				<?php
					echo "<form method=\"post\" onSubmit=\"return validar()\" action=\"anadir2.php?id_tipo=$tipo&id_usuario=$usuario\">";
						echo "<fieldset>";
							echo "<legend>Introduzca el nuevo libro</legend>";
							echo "<table border=\"1\" cellspacing=\"5\" cellpadding=\"3\">";
								echo "<tr>";
									echo "<td>";
										echo "<label align=\"left\">Autor: <input name=\"autor\" type=\"text\" maxlength=\"30\"></label>";
									echo "</td>";
									echo "<td>";
										echo "<label align=\"left\">T&iacute;tulo: <input name=\"titulo\" type=\"text\" maxlength=\"30\"></label>";
									echo "</td>";
									echo "<td>";
										echo "<label align=\"left\">I.S.B.N.: <input name=\"isbn\" type=\"text\" maxlength=\"17\"></label>";
									echo "</td>";
									echo "<td>";
										echo "<h3 align=\"center\"><input type=\"submit\" name=\"Submit\" value=\"A&ntilde;adir\"/></h3>";
									echo "</td>";
								echo "</tr>";
								echo "<tr>";
									echo "<td>";
										echo "<label align=\"left\">Editorial: <input type=\"text\" name=\"editorial\" maxlength=\"20\"></label>";
									echo "</td>";
									echo "<td>";
										echo "<label align=\"left\">A&#241o de edici&oacute;n: <input type=\"number\" name=\"ano\" maxlength=\"4\"></label>";
									echo "</td>";
									echo "<td>";
										echo "<label align=\"left\">G&eacute;nero: <input type=\"text\" name=\"genero\" maxlength=\"20\"></label>";
									echo "</td>";
									echo "<td>";
										echo "<label align=\"left\">Precio: <input type=\"number\" name=\"precio\" maxlength=\"6\"></label>";
									echo "</td>";
								echo "</tr>";
								echo "<tr>";
									echo "<td colspan=\"3\" align=\"left\">";
										echo "<label>Foto portada: <input type=\"file\" name=\"fotoportada\"></label>";
									echo "</td>";
									echo "<td>";
										echo "<label align=\"left\">Nombre datos principales: <input type=\"text\" name=\"datosprincipales\" maxlength=\"20\"></label>";
									echo "</td>";
								echo "</tr>";
								echo "<tr>";
									echo "<td colspan=\"4\" align=\"left\">";
										echo "<label valign=\"top\">Sinopsis: <textarea name=\"sinopsis\" cols=\"95\" rows=\"5\" maxlength=\"1000\"></textarea></label>";
									echo "</td>";
								echo "</tr>";
							echo "</table>";
						echo "</fieldset>";
					echo "</form>";
				?>
			</div>	 
		</div>
		<div class="pie">Carlos Guerrero Rodr&iacute;guez &#169;</div>
	</body>
</html>